﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace puzzle
{
    public class RockTile : IEquatable<RockTile>
    {
        public int X { get; set; }
        public int Y { get; set; }


        public RockTile(int x, int y)
        {
            X = x;
            Y = y;
        }

        public RockTile(RockTile tile)
        {
            X = tile.X;
            Y = tile.Y;
        }

        public bool nextTo(RockTile other)
        {
            return this.dist(other) == 1;
        }

        public int dist(RockTile other)
        {
            return Math.Abs(this.X - other.X) + Math.Abs(this.Y - other.Y);
        }

        public bool Equals(RockTile other)
        {
            if (other == null) return false;
            return this.dist(other) == 0;
        }
    }
}
